package com.example.administrator.idocment.docment;

import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;

import com.example.administrator.idocment.BaseTypeFind;
import com.example.administrator.idocment.msgpack.modelpack.PicModel;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/7/15 0015.
 */
public class PicFind extends BaseTypeFind<PicModel> {

    public static final String[] picType=new String[]{"image/bmp","image/jpeg","image/png"};

    public PicFind(Context context) {
        super(context);
    }
    List<PicModel> modelList=new ArrayList<>();
    @Override
    public void select() {


      try {
          Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
          String[] columName = new String[]{MediaStore.Images.Media.DATA, MediaStore.Images.Media.DATE_TAKEN,MediaStore.Images.Media.MIME_TYPE};
          String sort = MediaStore.Images.Media.DATE_TAKEN + " DESC";
          String where="";//MediaStore.Images.Media.SIZE+" >= "+(512*512);

          


          Cursor cursor = contentResolver.query(uri, columName, where, null, sort);
          cursor.moveToFirst();
          do {
              String path = cursor.getString(0);
             // long time = cursor.getLong(1);
             // String fotmatTime = TimerFactory.create(TimerFactory.YearFormat).paseTimer(time);
              android.util.Log.e("formatTime", cursor.getString(2));
              PicModel picModel=new PicModel();
              picModel.setImgPath(path);
              modelList.add(picModel);
          } while (cursor.moveToNext());

          cursor.close();
      }catch (Exception e)
      {
          android.util.Log.e("formatTime", e.toString());
      }

    }

    @Override
    public List<PicModel> getListInfo() {
        return modelList;
    }





}
